import  io  from    'socket.io-client';
import  config  from    '../config/config';

/**
 * how to use
 * 
 * const    socket = io('http://localhost');
            socket.on('connect', function(){});
            socket.on('event', function(data){});
            socket.on('disconnect', function(){});
 * 
 */


// const socket = io.connect(config.serverURL + '/ws/');

const socket = io(config.serverURL, {
    path: '/ws',
    transports: ['websocket']
});

// socket.emit();

/*      针对后台封装了 laravel-swoole 的 websocket 路由 中的 room   event_callback
socket.on('room', function (obj) {
    that.$store.commit('setUsers', obj);
});
*/

console.log('socket', socket);

export  default  socket;